'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up (queryInterface, Sequelize) {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
    const { STRING, BOOLEAN, UUIDV4, UUID, DATE, NOW } = Sequelize;
    await queryInterface.createTable('just_demo', {
      id: { type: UUID, defaultValue: UUIDV4, primaryKey: true },
      name: STRING(100),
      region: STRING(100),
      imgs: STRING(1500),
      date1: { type: DATE, defaultValue: NOW },
      date2: DATE,
      delivery: { type: BOOLEAN, allowNull: false, defaultValue: false, comment: '是否配送: 1 配送； 0 不配送' },
      classify: STRING(200),
      resource: STRING(200),
      remarks: STRING(100),
    });
  },

  async down (queryInterface, Sequelize) {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
    await queryInterface.dropTable('just_demo');
  },
};
